<?php
require_once 'AppController.php';


	//save to db
	$jsonStr = file_get_contents('php://input');
	
	$cellInfo = JSON_decode($jsonStr, true);

	$html = $cellInfo['html']; 
	$btnText = $cellInfo['buttonText'];
	$posX = $cellInfo['buttonX']; 
	$posY = $cellInfo['buttonY'];
	$eventID = $cellInfo['eventID'];
	
	$controller = new AppController();

	$html = htmlentities($html);

	$subsiteID = $controller->saveSubSite($html);
	
	echo $controller->saveCell($eventID, $btnText, $subsiteID, $posX, $posY);
?>